package demoMod.stsconsole.powers;

import demoMod.stsconsole.characters.AbstractPlayer;
import demoMod.stsconsole.core.AbstractCreature;
import demoMod.stsconsole.dungeons.AbstractDungeon;
import demoMod.stsconsole.helpers.DamageInfo;
import demoMod.stsconsole.interfaces.TurnStartSubscriber;

public class BrutalityPower extends AbstractPower implements TurnStartSubscriber {
    public static final String ID = "BrutalityPower";

    public BrutalityPower(AbstractCreature owner, int amount) {
        super(ID, owner, amount);
    }

    @Override
    public String getUpdatedDescriptions() {
        return String.format(this.description, this.owner.name, this.amount[0], this.amount[0]);
    }

    @Override
    public void atTurnStart(boolean isPlayer) {
        if (this.owner instanceof AbstractPlayer == isPlayer) {
            this.owner.damage(new DamageInfo(this.amount[0], this.owner, DamageInfo.DamageType.HP_LOSS));
            AbstractDungeon.player.draw(this.amount[0]);
        }
    }
}
